/*!
 * \file UapStateBase.h
 * \brief Base class for all states in state machine for
 * UAP protocol in Serving Gateway
 */

#ifndef SGW_UAP_STATE_BASE_H
#define SGW_UAP_STATE_BASE_H

#include "StateBase.h"
#include "UapGenerator.h"
#include "UapEventConnectionReq.h"
#include "UapEventConnectionReleaseReq.h"
#include "UapEventMediaBearerSetupReq.h"
#include "UapEventGapMediaBearerSetupCfm.h"
#include "UapEventGapMediaBearerSetupRej.h"
#include "UapEventGapMediaTransmissionFinishedInd.h"
#include "UapEventT643Expired.h"

namespace tsc
{
namespace sgw
{

using common::EventData;

/**
 * Base class for UAP states
 */
class UapStateBase : public common::StateBase
{
public:

	/**
	 * Handle specified event for the specified generator.
	 * When the event is handled by state it should be deleted
	 *
	 * \param generator the generator for which the event occurred
	 * \param event the event to handle
	 */
    virtual
	void handleEvent(common::Generator*  generator,
	                 common::EventData*& event);

	virtual void handleEventUapConnectionReq(
			UapGenerator* uapGen,
			UapEventConnectionReq* event,
			EventData*& eventData);

	virtual void handleEventUapConnectionReleaseReq(
			UapGenerator* uapGen,
			UapEventConnectionReleaseReq* event,
			EventData*& eventData);

	virtual void handleEventUapMediaBearerSetupReq(
	        UapGenerator* uapGen,
	        UapEventMediaBearerSetupReq* event,
	        EventData*& eventData);

	virtual void handleEventGapMediaBearerSetupCfm(
	        UapGenerator* uapGen,
	        UapEventGapMediaBearerSetupCfm* event,
	        EventData*& eventData);

	virtual void handleEventGapMediaBearerSetupRej(
            UapGenerator* uapGen,
            UapEventGapMediaBearerSetupRej* event,
            EventData*& eventData);

    virtual void handleEventGapMediaTransmissionFinishedInd(
            UapGenerator* uapGen,
            UapEventGapMediaTransmissionFinishedInd* event,
            EventData*& eventData);

    virtual void handleEventT643Expired(
            UapGenerator* uapGen,
            UapEventT643Expired* event,
            EventData*& eventData);

protected:

	/**
	 * Creates new UAP state with specified name
	 * \param name the name of state
	 */
	UapStateBase(const char* name);

	virtual ~UapStateBase();

};

} // namespace sgw
} // namespace tsc

#endif // SGW_UAP_STATE_BASE_H
